﻿using System;
using System.Collections.Generic;
using System.Text;
using SH;

namespace MTS
{
    class mtSysManageServerCallback:mtOuterface<ImtSysManageServerCallback>
    {
        public mtSysManageServerCallback()
        {
            m_interfaceName = "mtSysManageServerCallback";
            m_nClassID = ImtSysManageServerCallback._classID;
        }

        protected override shErrorCode OnRequest(int nClassID, int nFuncID, string token, ref MTSSerializer sc)
        {
            shErrorCode ec = shErrorCode.sh_ec_NoInterface;

            switch (nFuncID)
            {
                case ImtSysManageServerCallback.SysManageGStationRunStatusNotify:
                    {
                        mtGStationRunStatusInfo info = new mtGStationRunStatusInfo(); 

                        sc.serialize(info);

                        m_pHost.RunEnv.UpdateGStationRunStatus(info);

                        ec = m_pCallback.OnGStationRunStatusNotify(info);
                    }
                    break;
            case ImtSysManageServerCallback.SysManageGetGSystemRunStatus:
                    {
                        mtGSystemStatus info;

                        ec = m_pCallback.OnGetGSystemRunStatus(out info);

                        if(ec == shErrorCode.sh_ec_Success)
                        {
                            sc = new MTSSerializer();

                            sc.serialize(info);
                        }
                    }
                    break;
                case ImtSysManageServerCallback.SysManageGWFTaskProcessInfoNotify:
                    {
                        mtGWFTaskProcessInfo info = new mtGWFTaskProcessInfo();

                        sc.serialize(info);

                        ec = m_pCallback.OnGWFTaskProcessInfoNotify(info);

                     }
                    break;
                default:
                    return ec;
            }

            return ec;
        }
       
    }
}
